<?php

/*
 * 接口：/customer/add
 * 说明：添加客户
 */
 
$db->mysqlDB->falseAutoCommit();

//获取请求参数
$params = $route->bodyParams;

//添加客户
$P1 = array(
	"oc_name" => $params['oc_name'],
	"oc_phone" => $params['oc_phone'],
	"oc_qq" => $params['oc_qq'],
	"oc_weixin" => $params['oc_weixin'],
	"oc_address" => $params['oc_address'],
	"oc_desc" => $params['oc_desc'],
	"oc_way" => $params['oc_way'],
	"oc_provinces" => $params['oc_provinces'],
	"oc_city" => $params['oc_city'],
	"oc_area" => $params['oc_area'],
	"oc_email" => $params['oc_email'],
	"oc_sex" => $params['oc_sex'],
	"oc_create_time" => $params['oc_create_time']
);
$R1 = $db->mysqlDB->automaticAdd($P1)->insertTransaction("easyd_oa_customer");


//添加客户负责人
$P2 = array(
	"ocu_uid" => $params['ocu_uid'],
	"ocu_ocid" => $R1.result
);
$R2 = $db->mysqlDB->automaticAdd($P2)->insertTransaction("easyd_oa_customer_user");


if(!$R1||!$R2){
    $db->mysqlDB->rollBackCommint();
    $db->mysqlDB->trueAutoCommit();
    $response->responseData( false );
}else{
    $db->mysqlDB->actionCommint();
    $db->mysqlDB->trueAutoCommit();
    $response->responseData( true );
}


?>